

function addSensorbitCod(Blockly) {









    //TM1637 数码管初始化
   Blockly.Python.microbit_tm1637Init = function(block) {
    var dropdown_tm1637CLK = this.getFieldValue('tm1637CLK');
    var dropdown_tm1637DIO = this.getFieldValue('tm1637DIO');
    var dropdown_tm1637Intensity = this.getFieldValue('tm1637Intensity');
    Blockly.Python.definitions_['import_microbit'] = 'from microbit import *';
    Blockly.Python.definitions_['import_TM1637'] = 'from monitor import tm1637';
    return 'tm1637.init('+ dropdown_tm1637CLK + ', '+ dropdown_tm1637DIO + ', '+dropdown_tm1637Intensity +')\n';
  }
  
   //TM1637 数码管
   Blockly.Python.microbit_tm1637display = function(block) {
      var dropdown_TM1637Bit = this.getFieldValue('TM1637Bit');
      var dropdown_tm1637Data = Blockly.Python.valueToCode(this, 'tm1637Data', Blockly.Python.ORDER_ATOMIC);
      var dropdown_TM1637Point = this.getFieldValue('tm1637Point');
      return 'tm1637.show_digit(' + dropdown_tm1637Data + ', '+ dropdown_TM1637Bit + ', ' + dropdown_TM1637Point + ')\n';
  }

  // tm1650数码管显示数字
  Blockly.Python.microbit_tm1637ShowNumber = function(block){
    var dropdown_tm1637Number = Blockly.Python.valueToCode(this, 'tm1637Number', Blockly.Python.ORDER_ATOMIC);
    var dropdown_TM1637Point = this.getFieldValue('tm1637Point');
    return 'tm1637.show_number(' + dropdown_tm1637Number + ', ' + dropdown_TM1637Point +')\n';
  };

  //TM1637 数码管清屏
  Blockly.Python.microbit_tm1637Clear = function(block) {
    var dropdown_TM1650Bit = this.getFieldValue('TM1637Bit1');
    return 'tm1637.clear('+dropdown_TM1650Bit+')\n';
  }

    return Blockly;
}

module.exports = addSensorbitCod;

